<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style>
			body { margin: 0; }
		</style>
		<script src="../utils/setTitle.js"></script>
	</head>
	<body>
		<script type="importmap">
			{
				"imports": {
					"three": "https://unpkg.com/three/build/three.module.js"
				}
			}
		</script>
		<script type="module">
			import * as THREE from 'three';
			const scene = new THREE.Scene();
			const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
			const heartShape = new THREE.Shape();

			heartShape.moveTo( 25, 25 );
			heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 );
			heartShape.bezierCurveTo( - 30, 0, - 30, 35, - 30, 35 );
			heartShape.bezierCurveTo( - 30, 55, - 10, 77, 25, 95 );
			heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 );
			heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 );
			heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 );

			const extrudeSettings = { depth: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 };

			const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings );

			const mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial({ color: 0xffff00 }) );
			scene.add(mesh)
			camera.position.z = 500;
			const renderer = new THREE.WebGLRenderer();
			renderer.setSize( window.innerWidth, window.innerHeight );
			document.body.appendChild( renderer.domElement );
			function animate() {
				requestAnimationFrame( animate );
				mesh.rotation.x += 0.01;
				mesh.rotation.y += 0.01;
				renderer.setSize( window.innerWidth, window.innerHeight );
				renderer.render( scene, camera );
			}
			animate();
		</script>
	</body>
</html>